package com.example.security.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.security.mapper.SysPermissionMapper;
import com.example.security.service.ISysPermissionService;
import com.example.security.entity.SysPermission;

import java.util.List;

/**
 * @Description  
 * @author ZhiPeng.Lin
 * @Date 2022-02-10 
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements ISysPermissionService {

    @Autowired
    private SysPermissionMapper sysPermissionMapper;

    /**
     * 查询用户的权限.
     *
     * @param userId
     * @return
     */
    @Override
    public List<SysPermission> selectListByUser(Integer userId) {
        return sysPermissionMapper.selectByUser(userId);
    }

    /**
     * 查询具体某个接口的权限
     *
     * @param requestUrl
     * @return
     */
    @Override
    public List<SysPermission> selectListByPath(String requestUrl) {
        return sysPermissionMapper.selectListByPath(requestUrl);
    }
}
